package com.zsc.wxapp.controller;

import com.zsc.wxapp.entity.User;
import com.zsc.wxapp.properties.Test;
import com.zsc.wxapp.result.Result;
import com.zsc.wxapp.services.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController
@RequestMapping("/test")
//@Api(tags = "测试接口")
@Slf4j
public class testCollect {

    @Resource
    private TestService testService;
    @Resource
    private Test test;

    @GetMapping("/testMysql")
//    @ApiOperation("测试mysql连接")
    public Result<User> testMysql() {
        log.info("url:{}", test.getUrl());
        return Result.success(testService.testMysql());
    }

    @GetMapping("getLocalDateTime")
//    @ApiOperation("获取当前时间")
    public Result<?> getLocalDateTime() {
        return Result.success(LocalDateTime.now());
    }

    @GetMapping("/processed")
//    @ApiOperation("处理custUuid和custCode数据")
    public Result<?> testExcel() {
        log.info("处理数据");
        testService.processedData();
        return Result.success();
    }


//    /**
//     * 下载文件
//     * @param fileName 文件路径
//     * @return
//     */
//    @GetMapping("/downloadFile")
//    public String downloadFile(@RequestParam String fileName) {
//        MinioClient minioClient = minIOService.getMinioClient();
//        if (minioClient == null) {
//            return "连接MinIO服务器失败";
//        }
//        return minIOService.downloadFile(minioClient, fileName) != null ? "下载成功" : "下载失败";
//    }

}
